package com.gm.wholesale.module.login.jsfunction;
import android.webkit.JavascriptInterface;
import com.gm.wholesale.module.login.ui.LoginActivity;
import com.gm.wholesale.module.user.UserDataManger;

public class LoginWebViewCallBack extends Object{
    public static final String loginViewCallBack = "app";
    private LoginActivity mActivity;

    public LoginWebViewCallBack(LoginActivity activity) {
        this.mActivity = activity;
    }

    // todo 登录成功后 网页回调
    @JavascriptInterface
    public void loginSuccess(String userData) {
        UserDataManger.newInstance().saveUserInfo(userData);
        mActivity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (mActivity!=null){
                    mActivity.loginSuccess();
                }
            }
        });


    }


}
